/* @(#)GSBalanceFeeProcessor.java    V0.1
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-5-17
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.business;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSBalanceFeeBean;

import com.hitrust.gs.dao.GSBalanceFeeDAO;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.service.GSBaseProcesser;
import com.hitrust.gs.util.exception.GSException;

/**
 * 
 */
public class GSBalanceFeeProcessor implements GSBaseProcesser{
   /**
    * 增加结算费用类型任务
    * @param aGSBalanceFeeBean
    * @throws GSException
    */
    public static void addTask(GSBalanceFeeBean aGSBalanceFeeBean)throws GSException {
        GSBalanceFeeDAO tGSBalanceFeeDAO = new GSBalanceFeeDAO();
           
            if (tGSBalanceFeeDAO.add(aGSBalanceFeeBean) == false) {
                throw new GSException("增加结算费用失败!");
            }
        }
    /**
     * 修改结算费用类型任务
     * @param aGSBalanceFeeBean
     * @throws GSException
     */
    public static void modifyTask(GSBalanceFeeBean aGSBalanceFeeBean)throws GSException {
        GSBalanceFeeDAO tGSBalanceFeeDAO = new GSBalanceFeeDAO();
           
            if (tGSBalanceFeeDAO.modify(aGSBalanceFeeBean) == false) {
                throw new GSException("修改结算费用失败!");
            }
        }
    
    /**
     * 得到所有的费用类型
     * @return
     * @throws GSException
     */
    public static ArrayList getAllFeeType()throws GSException{
        GSBalanceFeeDAO tGSBalanceFeeDAO = new GSBalanceFeeDAO();
        
        ArrayList tArrayList=new ArrayList();
        try {
            //通过机构编号和机构名称查询所有机构信息
            ArrayList  tBalanceFeeList=tGSBalanceFeeDAO.queryAllFeeType();
            if (tBalanceFeeList.size() > 0) {
                
                for (int i = 0; i < tBalanceFeeList.size(); i++) {

                    GSBalanceFeeBean tGSBalanceFeeBean = (GSBalanceFeeBean) tBalanceFeeList.get(i);
                    String[] tStr = new String[3];
                    tStr[0] = tGSBalanceFeeBean.getGs_fee_type_no();
                    tStr[1] = tGSBalanceFeeBean.getGs_fee_type();
                    tStr[2] = tGSBalanceFeeBean.getGs_dis_no();
                    
                    tArrayList.add(tStr);
                    
                }
            }
            
        } catch (GSException e) {
            GSLogWriter.error("GSBalanceFeeProcessor GSException: " +e.toString());
        }
        return tArrayList;
    }
    /**
     * 得到所有的费用类型信息
     * 
     * @param aFeeTypeNo
     *            机构编号
     * @throws GSException          
     */
    public static GSBalanceFeeBean getFee(String aFeeTypeNo)throws GSException{
        GSBalanceFeeDAO tGSBalanceFeeDAO = new GSBalanceFeeDAO();
        
        GSBalanceFeeBean tGSBalanceFeeBean = new GSBalanceFeeBean();  
        try {
            //通过机构编号和机构名称查询所有机构信息
            tGSBalanceFeeBean=tGSBalanceFeeDAO.getFeeType(aFeeTypeNo);
        } catch (GSException e) {
            GSLogWriter.error("GSBalanceFeeProcessor GSException: " +e.toString());
        }
        return tGSBalanceFeeBean;
    }
    /**
     * 删除费用类型信息
     * @param aGSBalanceFeeBean
     * @throws GSException
     */
    public static void delTask(String aTypeNo)throws GSException {
        GSBalanceFeeDAO tGSBalanceFeeDAO = new GSBalanceFeeDAO();
           
            if (tGSBalanceFeeDAO.delete(aTypeNo) == false) {
                throw new GSException("删除结算费用失败!");
            }
        }
}
